package android.slc.box.commonlibrary.compat.slc_cache;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

import java.lang.annotation.Annotation;

public class CacheExclusionStrategy implements ExclusionStrategy {
    private final Class<? extends Annotation> annotationClass;

    public CacheExclusionStrategy(Class<? extends Annotation> annotationClass) {
        this.annotationClass = annotationClass;
    }

    @Override
    public boolean shouldSkipField(FieldAttributes f) {
        return f.getAnnotation(annotationClass) != null;
    }

    @Override
    public boolean shouldSkipClass(Class<?> clazz) {
        return false;
    }
}